<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
    	<meta name="viewport" content="width=device-width, initial-scale=1.0">
    	<meta http-equiv="X-UA-Compatible" content="IE=edge,Chrome=1" />
		<title>需求信息列表</title>
		<script type="text/javascript" src="js/common.js"></script>
	</head>
	<body>
		<div id="frame_child">
			<div class="accounttitle">
				<p>审核>需求信息</p>
            </div>
            <div class="comform-inline">
                <label>状态：</label>
                <select id="dataType" style="width: 100px;">
                    <option value="0" selected>全部</option>
                    <option value="-1">未审核</option>
                    <option value="1">已审核</option>
                </select>
				<button type="button" id="searchBtn" class="btn">查询</button>
			</div>
			<table class="table_at">
				<tr class="ac_title">
					<th style="width: 5%;">序号</th>
					<th style="width: 30%;">企业名称</th>
					<th style="width: 35%;">需求描述</th>
                    <!-- <th style="width: 10%;">创建时间</th> -->
                    <th style="width: 10%;">状态</th>
					<th style="width: 20%;">操作</th>
                </tr>
                <tbody id="list">

                </tbody>
			</table>
			<!--分页-->
			<div class="pagination-box">
                <ul class="pagination">
                </ul>
            </div>
        </div>
        <!-- 查看模态框（Modal） -->
        <div class="modal fade" id="myModal1" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
            <div class="modal-dialog">
                <div class="modal-content">
                    <div class="modal-header">
                        <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
                        <h4 class="modal-title" id="myModalLabel">需求详情</h4>
                    </div>
                    <div class="modal-body">
                        <form class="form-horizontal" role="form" id="myModal1-body">

                        </form>                          
                    </div>
                    <div class="modal-footer">
                        <button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
                    </div>
                </div><!-- /.modal-content -->
            </div><!-- /.modal-dialog -->
        </div>
        <!-- /.modal -->
        <!-- 修改模态框（Modal2） -->
        <div class="modal fade" id="myModal2" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
            <div class="modal-dialog">
                <div class="modal-content">
                    <div class="modal-header">
                        <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
                        <h4 class="modal-title" id="myModalLabel">需求详情</h4>
                    </div>
                    <div class="modal-body">
                        <form class="form-horizontal" role="form" id="myModal2-body">

                        </form>                          
                    </div>
                    <div class="modal-footer">
                        <button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
                        <button type="button" class="btn btn-primary">保存修改</button>
                    </div>
                </div><!-- /.modal-content -->
            </div><!-- /.modal-dialog -->
        </div>
        <!-- /.modal -->
        <!-- 修改模态框（Modal2） -->
        <div class="modal fade" id="myModal3" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
            <div class="modal-dialog">
                <div class="modal-content">
                    <div class="modal-header">
                        <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
                        <h4 class="modal-title" id="myModalLabel">需求详情</h4>
                    </div>
                    <div class="modal-body">
                        <form class="form-horizontal" role="form" id="myModal3-body">

                        </form>                          
                    </div>
                    <div class="modal-footer">
                        <button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
                        <button type="button" class="btn btn-primary">审核</button>
                    </div>
                </div><!-- /.modal-content -->
            </div><!-- /.modal-dialog -->
        </div>
        <!-- /.modal -->
        <!-- 删除模态框（Modal2） -->
        <div class="modal fade" id="myModal4" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
            <div class="modal-dialog">
                <div class="modal-content">
                    <div class="modal-header">
                        <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
                        <h4 class="modal-title" id="myModalLabel">需求详情</h4>
                    </div>
                    <div class="modal-body">
                        <form class="form-horizontal" role="form" id="myModal4-body">

                        </form>                          
                    </div>
                    <div class="modal-footer">
                        <button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
                        <button type="button" class="btn btn-primary">删除</button>
                    </div>
                </div><!-- /.modal-content -->
            </div><!-- /.modal-dialog -->
        </div>
        <!-- /.modal -->
        
        <script type="text/javascript">
            var pageNo = 1
            var pageSize = 10
            var nowData = null // 存储当前查看详情的互动信息数据
			
            $(document).ready(function(){
                loadResult()
                $('#searchBtn').click(function(){
                    loadResult()
                })
                
                // 查看按钮
                $('#list').on('click', '.do-chakan', function(){
                    var id = $(this).attr('add-id')
                    $('#myModal1-body').empty()
                    $.ajax({
                        url: service_url + '/a/zhiku/zkLinkInteraction/queryOneZkLinkAndPic/'+ id+'?token=' + $.cookie('AuthorizationAdmin'),
                        type: 'GET',
                        xhrFields: {
                            withCredentials: true
                        },
                        crossDomain: true,
                        contentType: 'application/json',
                        dataType: 'jsonp',
                        jsonpCallback:"success_jsonpCallback",  
                        processData: false, // 告诉jQuery不要去处理发送的数据
                        success: function(data) {
                            if (data.status === '00') {
                                var pictureMessages = JSON.parse(data.data).pictureMessages
                                var data = JSON.parse(data.data).interaction
                                var tempHtml = ''
                                if (data.topic !== undefined) {
                                    tempHtml = tempHtml + '<div class="form-group"><label  class="col-sm-2 control-label">活动主题</label><div class="col-sm-10"><input type="text" class="form-control" id="topic" readonly value="'+data.topic+'"></div></div>'
                                }
                                if (data.type !== undefined) {
                                    tempHtml = tempHtml + '<div class="form-group"><label for="type" class="col-sm-2 control-label">需求类型</label><div class="col-sm-10"><input type="text" class="form-control" id="type" readonly value="'+data.type+'"></div></div>'
                                }
                                if (data.addr !== undefined) {
                                    tempHtml = tempHtml + '<div class="form-group"><label for="addr" class="col-sm-2 control-label">活动地址</label><div class="col-sm-10"><input type="text" class="form-control" id="addr" readonly value="'+data.addr+'"></div></div>'
                                }
                                if (data.contact !== undefined) {
                                    tempHtml = tempHtml + '<div class="form-group"><label for="contact" class="col-sm-2 control-label">联系人</label><div class="col-sm-10"><input type="text" class="form-control" id="contact" readonly value="'+data.contact+'"></div></div>'
                                }
                                if (data.position !== undefined) {
                                    tempHtml = tempHtml + '<div class="form-group"><label for="position" class="col-sm-2 control-label">职位</label><div class="col-sm-10"><input type="text" class="form-control" id="position" readonly value="'+data.position+'"></div></div>'
                                }
                                if (data.mobile !== undefined) {
                                    tempHtml = tempHtml + '<div class="form-group"><label for="mobile" class="col-sm-2 control-label">联系方式</label><div class="col-sm-10"><input type="text" class="form-control" id="mobile" readonly value="'+data.mobile+'"></div></div>'
                                }
                                if (data.createDateStr !== undefined) {
                                    tempHtml = tempHtml + '<div class="form-group"><label for="createDateStr" class="col-sm-2 control-label">创建时间</label><div class="col-sm-10"><input type="text" class="form-control" id="createDateStr" readonly value="'+data.createDateStr+'"></div></div>'
                                }
                                if (data.description !== undefined) {
                                    tempHtml = tempHtml + '<div class="form-group"><label for="description" class="col-sm-2 control-label">互动描述</label><div class="col-sm-10"><textarea class="form-control" rows="3" readonly id="description">'+data.description+'</textarea></div></div>'
                                }
                                if (data.labelVerify !== undefined) {
                                    var labelVerify =  data.labelVerify
                                    if (labelVerify === '-1') {
                                        labelVerify = '未审核'
                                    }
                                    if (labelVerify === '1') {
                                        labelVerify = '已审核'
                                    }
                                    tempHtml = tempHtml + '<div class="form-group"><label for="labelVerify" class="col-sm-2 control-label">审核状态</label><div class="col-sm-10"><input type="text" class="form-control" id="labelVerify" readonly value="'+labelVerify+'"></div></div>'
                                }
                                if (pictureMessages !== undefined && pictureMessages.length > 0) {
                                    tempHtml = tempHtml + '<div class="row">'
                                    for (var i = 0; i <  pictureMessages.length; i++) {
                                        var imgDescription = pictureMessages[i].description || ''
                                        tempHtml = tempHtml + '<div class="thumbnail"><img src="'+service_url + '/a/zhiku/zkLinkInteraction/getPic?id=' + pictureMessages[i].id+'" ><div class="caption"><p><b>图片描述:</b>'+imgDescription+'</p></div></div>'
                                    }
                                    tempHtml = tempHtml + '</div>'
                                }
                                $('#myModal1-body').append(tempHtml)
                                $('#myModal1').modal('show');
                            } else {
                                showErr("获取需求详情失败",)
                            }   
                        },
                        error: function(XMLHttpRequest, textStatus, errorThrown) {
                            console.log(XMLHttpRequest, textStatus, errorThrown)
                        }
                    })
                })
            
                // 修改按钮
                $('#list').on('click', '.do-xiugai', function(){
                    var id = $(this).attr('add-id')
                    $('#myModal2-body').empty()
                    $.ajax({
                        url: service_url + '/a/zhiku/zkLinkInteraction/queryOneZkLinkAndPic/'+ id+'?token=' + $.cookie('AuthorizationAdmin'),
                        type: 'GET',
                        xhrFields: {
                            withCredentials: true
                        },
                        crossDomain: true,
                        contentType: 'application/json',
                        dataType: 'jsonp',
                        jsonpCallback:"success_jsonpCallback",  
                        processData: false, // 告诉jQuery不要去处理发送的数据
                        success: function(data) {
                            if (data.status === '00') {
                                nowData = data
                                var pictureMessages = JSON.parse(data.data).pictureMessages
                                var data = JSON.parse(data.data).interaction
                                var tempHtml = ''
                                if (data.topic !== undefined) {
                                    tempHtml = tempHtml + '<div class="form-group"><label  class="col-sm-2 control-label">活动主题</label><div class="col-sm-10"><input type="text" class="form-control" id="topic2" value="'+data.topic+'"></div></div>'
                                }
                                if (data.type !== undefined) {
                                    tempHtml = tempHtml + '<div class="form-group"><label for="type" class="col-sm-2 control-label">需求类型</label><div class="col-sm-10"><input type="text" class="form-control" id="type2" value="'+data.type+'"></div></div>'
                                }
                                if (data.addr !== undefined) {
                                    tempHtml = tempHtml + '<div class="form-group"><label for="addr" class="col-sm-2 control-label">活动地址</label><div class="col-sm-10"><input type="text" class="form-control" id="addr2" value="'+data.addr+'"></div></div>'
                                }
                                if (data.contact !== undefined) {
                                    tempHtml = tempHtml + '<div class="form-group"><label for="contact" class="col-sm-2 control-label">联系人</label><div class="col-sm-10"><input type="text" class="form-control" id="contact2" value="'+data.contact+'"></div></div>'
                                }
                                if (data.position !== undefined) {
                                    tempHtml = tempHtml + '<div class="form-group"><label for="position" class="col-sm-2 control-label">职位</label><div class="col-sm-10"><input type="text" class="form-control" id="position2" value="'+data.position+'"></div></div>'
                                }
                                if (data.mobile !== undefined) {
                                    tempHtml = tempHtml + '<div class="form-group"><label for="mobile" class="col-sm-2 control-label">联系方式</label><div class="col-sm-10"><input type="text" class="form-control" id="mobile2" value="'+data.mobile+'"></div></div>'
                                }
                                if (data.createDateStr !== undefined) {
                                    tempHtml = tempHtml + '<div class="form-group"><label for="createDateStr" class="col-sm-2 control-label">创建时间</label><div class="col-sm-10"><input type="text" class="form-control" id="createDateStr2" readonly value="'+data.createDateStr+'"></div></div>'
                                }
                                if (data.description !== undefined) {
                                    tempHtml = tempHtml + '<div class="form-group"><label for="description" class="col-sm-2 control-label">互动描述</label><div class="col-sm-10"><textarea class="form-control" rows="3" id="description2">'+data.description+'</textarea></div></div>'
                                }
                                if (data.labelVerify !== undefined) {
                                    var labelVerify =  data.labelVerify
                                    if (labelVerify === '-1') {
                                        labelVerify = '未审核'
                                    }
                                    if (labelVerify === '1') {
                                        labelVerify = '已审核'
                                    }
                                    tempHtml = tempHtml + '<div class="form-group"><label for="labelVerify" class="col-sm-2 control-label">审核状态</label><div class="col-sm-10"><input type="text" class="form-control" id="labelVerify2" readonly value="'+labelVerify+'"></div></div>'
                                }
                                if (pictureMessages !== undefined && pictureMessages.length > 0) {
                                    tempHtml = tempHtml + '<div class="row">'
                                    for (var i = 0; i <  pictureMessages.length; i++) {
                                        var imgDescription = pictureMessages[i].description || ''
                                        tempHtml = tempHtml + '<div class="thumbnail"><img src="'+service_url + '/a/zhiku/zkLinkInteraction/getPic?id=' + pictureMessages[i].id+'" ><div class="caption"><p><b>图片描述:</b>'+imgDescription+'</p></div></div>'
                                    }
                                    tempHtml = tempHtml + '</div>'
                                }
                                $('#myModal2-body').append(tempHtml)
                                $('#myModal2').modal('show');
                            } else {
                                showErr("获取需求详情失败")
                            }   
                        },
                        error: function(XMLHttpRequest, textStatus, errorThrown) {
                            showErr("获取需求详情失败")
                            console.log(XMLHttpRequest, textStatus, errorThrown)
                        }
                    })
                })
                $('#myModal2 .btn-primary').click(function() {
                    top.confirm("您确定要保存吗", "", function(isConfirm) {
						if(isConfirm) {
                            var data = JSON.parse(nowData.data).interaction
                            var paramStr = 'id=' + data.id +'&'
                            if (data.topic !== undefined) {
                                paramStr = paramStr + 'topic=' + encodeURIComponent($('#topic2').val()) +'&'
                            }
                            if (data.type !== undefined) {
                                paramStr = paramStr + 'type=' + encodeURIComponent($('#type2').val()) +'&'
                            }
                            if (data.addr !== undefined) {
                                paramStr = paramStr + 'addr=' + encodeURIComponent($('#addr2').val()) +'&'
                            }
                            if (data.contact !== undefined) {
                                paramStr = paramStr + 'contact=' + encodeURIComponent($('#contact2').val()) +'&'
                            }
                            if (data.position !== undefined) {
                                paramStr = paramStr + 'position=' + encodeURIComponent($('#position2').val()) +'&'
                            }
                            if (data.mobile !== undefined) {
                                paramStr = paramStr + 'mobile=' + encodeURIComponent($('#mobile2').val()) +'&'
                            }
                            if (data.description !== undefined) {
                                paramStr = paramStr + 'description=' + encodeURIComponent($('#description2').val()) +'&'
                            }
                            paramStr = paramStr + 'token=' + $.cookie('AuthorizationAdmin')

                            $.ajax({
                                url: service_url + '/a/zhiku/zkLinkInteraction/updateOneZkLinkAndPic?' + paramStr,
                                type: 'GET',
                                xhrFields: {
                                    withCredentials: true
                                },
                                crossDomain: true,
                                contentType: 'application/json',
                                dataType: 'jsonp',
                                jsonpCallback:"success_jsonpCallback",  
                                processData: false, // 告诉jQuery不要去处理发送的数据
                                success: function(data) {
                                    // console.log('>>>>', data)
                                    if (data.status === '00') {
                                        $('#myModal2').modal('hide')
                                        loadResult()
                                        top.alert("修改成功",{type: 'success'});
                                    } else {
                                        showErr("保存修改失败")
                                    } 
                                },
                                error: function(XMLHttpRequest, textStatus, errorThrown) {
                                    showErr("保存修改失败")
                                    console.log(XMLHttpRequest, textStatus, errorThrown)
                                }
                            })
						} else {
							//after click the cancel
						}

					}, {
						confirmButtonText: '确定',
						cancelButtonText: '取消',
						width: 400
					})
                })
            
                // 审核按钮
                $('#list').on('click', '.do-shenhe', function(){
                    var id = $(this).attr('add-id')
                    $('#myModal3-body').empty()
                    $.ajax({
                        url: service_url + '/a/zhiku/zkLinkInteraction/queryOneZkLinkAndPic/'+ id+'?token=' + $.cookie('AuthorizationAdmin'),
                        type: 'GET',
                        xhrFields: {
                            withCredentials: true
                        },
                        crossDomain: true,
                        contentType: 'application/json',
                        dataType: 'jsonp',
                        jsonpCallback:"success_jsonpCallback",  
                        processData: false, // 告诉jQuery不要去处理发送的数据
                        success: function(data) {
                            if (data.status === '00') {
                                nowData = data
                                var pictureMessages = JSON.parse(data.data).pictureMessages
                                var data = JSON.parse(data.data).interaction
                                var tempHtml = ''
                                if (data.topic !== undefined) {
                                    tempHtml = tempHtml + '<div class="form-group"><label  class="col-sm-2 control-label">活动主题</label><div class="col-sm-10"><input type="text" class="form-control" id="topic" readonly value="'+data.topic+'"></div></div>'
                                }
                                if (data.type !== undefined) {
                                    tempHtml = tempHtml + '<div class="form-group"><label for="type" class="col-sm-2 control-label">需求类型</label><div class="col-sm-10"><input type="text" class="form-control" id="type" readonly value="'+data.type+'"></div></div>'
                                }
                                if (data.addr !== undefined) {
                                    tempHtml = tempHtml + '<div class="form-group"><label for="addr" class="col-sm-2 control-label">活动地址</label><div class="col-sm-10"><input type="text" class="form-control" id="addr" readonly value="'+data.addr+'"></div></div>'
                                }
                                if (data.contact !== undefined) {
                                    tempHtml = tempHtml + '<div class="form-group"><label for="contact" class="col-sm-2 control-label">联系人</label><div class="col-sm-10"><input type="text" class="form-control" id="contact" readonly value="'+data.contact+'"></div></div>'
                                }
                                if (data.position !== undefined) {
                                    tempHtml = tempHtml + '<div class="form-group"><label for="position" class="col-sm-2 control-label">职位</label><div class="col-sm-10"><input type="text" class="form-control" id="position" readonly value="'+data.position+'"></div></div>'
                                }
                                if (data.mobile !== undefined) {
                                    tempHtml = tempHtml + '<div class="form-group"><label for="mobile" class="col-sm-2 control-label">联系方式</label><div class="col-sm-10"><input type="text" class="form-control" id="mobile" readonly value="'+data.mobile+'"></div></div>'
                                }
                                if (data.createDateStr !== undefined) {
                                    tempHtml = tempHtml + '<div class="form-group"><label for="createDateStr" class="col-sm-2 control-label">创建时间</label><div class="col-sm-10"><input type="text" class="form-control" id="createDateStr" readonly value="'+data.createDateStr+'"></div></div>'
                                }
                                if (data.description !== undefined) {
                                    tempHtml = tempHtml + '<div class="form-group"><label for="description" class="col-sm-2 control-label">互动描述</label><div class="col-sm-10"><textarea class="form-control" rows="3" readonly id="description">'+data.description+'</textarea></div></div>'
                                }
                                if (data.labelVerify !== undefined) {
                                    var labelVerify =  data.labelVerify
                                    if (labelVerify === '-1') {
                                        labelVerify = '未审核'
                                    }
                                    if (labelVerify === '1') {
                                        labelVerify = '已审核'
                                    }
                                    tempHtml = tempHtml + '<div class="form-group"><label for="labelVerify" class="col-sm-2 control-label">审核状态</label><div class="col-sm-10"><input type="text" class="form-control" id="labelVerify" readonly value="'+labelVerify+'"></div></div>'
                                }
                                if (pictureMessages !== undefined && pictureMessages.length > 0) {
                                    tempHtml = tempHtml + '<div class="row">'
                                    for (var i = 0; i <  pictureMessages.length; i++) {
                                        var imgDescription = pictureMessages[i].description || ''
                                        tempHtml = tempHtml + '<div class="thumbnail"><img src="'+service_url + '/a/zhiku/zkLinkInteraction/getPic?id=' + pictureMessages[i].id+'" ><div class="caption"><p><b>图片描述:</b>'+imgDescription+'</p></div></div>'
                                    }
                                    tempHtml = tempHtml + '</div>'
                                }
                                $('#myModal3-body').append(tempHtml)
                                $('#myModal3').modal('show');
                            } else {
                                showErr("获取需求详情失败",)
                            }   
                        },
                        error: function(XMLHttpRequest, textStatus, errorThrown) {
                            showErr("获取需求详情失败")
                            console.log(XMLHttpRequest, textStatus, errorThrown)
                        }
                    })
                })

                $('#myModal3 .btn-primary').click(function() {
                    top.confirm("您确定要审核通过本条互动信息吗", "", function(isConfirm) {
						if(isConfirm) {
                            var data = JSON.parse(nowData.data).interaction
                            var paramStr = 'id=' + data.id +'&'
                            if (data.contact !== undefined) {
                                paramStr = paramStr + 'contact=' + encodeURIComponent($('#contact2').val()) +'&'
                            }
                            if (data.position !== undefined) {
                                paramStr = paramStr + 'position=' + encodeURIComponent($('#position2').val()) +'&'
                            }
                            if (data.mobile !== undefined) {
                                paramStr = paramStr + 'mobile=' + encodeURIComponent($('#mobile2').val()) +'&'
                            }
                            paramStr = paramStr + 'token=' + $.cookie('AuthorizationAdmin')

                            $.ajax({
                                url: service_url + '/a/zhiku/zkLinkInteraction/verify?' + paramStr,
                                type: 'GET',
                                xhrFields: {
                                    withCredentials: true
                                },
                                crossDomain: true,
                                contentType: 'application/json',
                                dataType: 'jsonp',
                                jsonpCallback:"success_jsonpCallback",  
                                processData: false, // 告诉jQuery不要去处理发送的数据
                                success: function(data) {
                                    // console.log('>>>>', data)
                                    if (data.status === '00') {
                                        $('#myModal3').modal('hide')
                                        loadResult()
                                        top.alert("审核成功",{type: 'success'});
                                    } else {
                                        showErr("审核失败")
                                    } 
                                },
                                error: function(XMLHttpRequest, textStatus, errorThrown) {
                                    showErr("审核失败")
                                    console.log(XMLHttpRequest, textStatus, errorThrown)
                                }
                            })
						} else {
							//after click the cancel
						}

					}, {
						confirmButtonText: '确定',
						cancelButtonText: '取消',
						width: 400
					})
                })

                // 删除按钮
                $('#list').on('click', '.do-shanchu', function(){
                    var id = $(this).attr('add-id')
                    $('#myModal4-body').empty()
                    $.ajax({
                        url: service_url + '/a/zhiku/zkLinkInteraction/queryOneZkLinkAndPic/'+ id+'?token=' + $.cookie('AuthorizationAdmin'),
                        type: 'GET',
                        xhrFields: {
                            withCredentials: true
                        },
                        crossDomain: true,
                        contentType: 'application/json',
                        dataType: 'jsonp',
                        jsonpCallback:"success_jsonpCallback",  
                        processData: false, // 告诉jQuery不要去处理发送的数据
                        success: function(data) {
                            if (data.status === '00') {
                                nowData = data
                                var pictureMessages = JSON.parse(data.data).pictureMessages
                                var data = JSON.parse(data.data).interaction
                                var tempHtml = ''
                                if (data.topic !== undefined) {
                                    tempHtml = tempHtml + '<div class="form-group"><label  class="col-sm-2 control-label">活动主题</label><div class="col-sm-10"><input type="text" class="form-control" id="topic" readonly value="'+data.topic+'"></div></div>'
                                }
                                if (data.type !== undefined) {
                                    tempHtml = tempHtml + '<div class="form-group"><label for="type" class="col-sm-2 control-label">需求类型</label><div class="col-sm-10"><input type="text" class="form-control" id="type" readonly value="'+data.type+'"></div></div>'
                                }
                                if (data.addr !== undefined) {
                                    tempHtml = tempHtml + '<div class="form-group"><label for="addr" class="col-sm-2 control-label">活动地址</label><div class="col-sm-10"><input type="text" class="form-control" id="addr" readonly value="'+data.addr+'"></div></div>'
                                }
                                if (data.contact !== undefined) {
                                    tempHtml = tempHtml + '<div class="form-group"><label for="contact" class="col-sm-2 control-label">联系人</label><div class="col-sm-10"><input type="text" class="form-control" id="contact" readonly value="'+data.contact+'"></div></div>'
                                }
                                if (data.position !== undefined) {
                                    tempHtml = tempHtml + '<div class="form-group"><label for="position" class="col-sm-2 control-label">职位</label><div class="col-sm-10"><input type="text" class="form-control" id="position" readonly value="'+data.position+'"></div></div>'
                                }
                                if (data.mobile !== undefined) {
                                    tempHtml = tempHtml + '<div class="form-group"><label for="mobile" class="col-sm-2 control-label">联系方式</label><div class="col-sm-10"><input type="text" class="form-control" id="mobile" readonly value="'+data.mobile+'"></div></div>'
                                }
                                if (data.createDateStr !== undefined) {
                                    tempHtml = tempHtml + '<div class="form-group"><label for="createDateStr" class="col-sm-2 control-label">创建时间</label><div class="col-sm-10"><input type="text" class="form-control" id="createDateStr" readonly value="'+data.createDateStr+'"></div></div>'
                                }
                                if (data.description !== undefined) {
                                    tempHtml = tempHtml + '<div class="form-group"><label for="description" class="col-sm-2 control-label">互动描述</label><div class="col-sm-10"><textarea class="form-control" rows="3" readonly id="description">'+data.description+'</textarea></div></div>'
                                }
                                if (data.labelVerify !== undefined) {
                                    var labelVerify =  data.labelVerify
                                    if (labelVerify === '-1') {
                                        labelVerify = '未审核'
                                    }
                                    if (labelVerify === '1') {
                                        labelVerify = '已审核'
                                    }
                                    tempHtml = tempHtml + '<div class="form-group"><label for="labelVerify" class="col-sm-2 control-label">审核状态</label><div class="col-sm-10"><input type="text" class="form-control" id="labelVerify" readonly value="'+labelVerify+'"></div></div>'
                                }
                                if (pictureMessages !== undefined && pictureMessages.length > 0) {
                                    tempHtml = tempHtml + '<div class="row">'
                                    for (var i = 0; i <  pictureMessages.length; i++) {
                                        var imgDescription = pictureMessages[i].description || ''
                                        tempHtml = tempHtml + '<div class="thumbnail"><img src="'+service_url + '/a/zhiku/zkLinkInteraction/getPic?id=' + pictureMessages[i].id+'" ><div class="caption"><p><b>图片描述:</b>'+imgDescription+'</p></div></div>'
                                    }
                                    tempHtml = tempHtml + '</div>'
                                }
                                $('#myModal4-body').append(tempHtml)
                                $('#myModal4').modal('show');
                            } else {
                                showErr("获取需求详情失败",)
                            }   
                        },
                        error: function(XMLHttpRequest, textStatus, errorThrown) {
                            showErr("获取需求详情失败")
                            console.log(XMLHttpRequest, textStatus, errorThrown)
                        }
                    })
                })

                $('#myModal4 .btn-primary').click(function() {
                    top.confirm("您确定要删除本条互动信息吗", "", function(isConfirm) {
						if(isConfirm) {
                            var data = JSON.parse(nowData.data).interaction
                            var paramStr = data.id +'?' + 'token=' + $.cookie('AuthorizationAdmin')
                            $.ajax({
                                url: service_url + '/a/zhiku/zkLinkInteraction/delete/' + paramStr,
                                type: 'GET',
                                xhrFields: {
                                    withCredentials: true
                                },
                                crossDomain: true,
                                contentType: 'application/json',
                                dataType: 'jsonp',
                                jsonpCallback:"success_jsonpCallback",  
                                processData: false, // 告诉jQuery不要去处理发送的数据
                                success: function(data) {
                                    // console.log('>>>>', data)
                                    if (data.status === '00') {
                                        $('#myModal4').modal('hide')
                                        loadResult()
                                        top.alert("删除成功",{type: 'success'});
                                    } else {
                                        showErr("删除失败")
                                    } 
                                },
                                error: function(XMLHttpRequest, textStatus, errorThrown) {
                                    showErr("删除失败")
                                    console.log(XMLHttpRequest, textStatus, errorThrown)
                                }
                            })
						} else {
							//after click the cancel
						}

					}, {
						confirmButtonText: '确定',
						cancelButtonText: '取消',
						width: 400
					})
                })
            })
            // 根据条件查询
            function loadResult() {
                $('#list').empty()
                $('.pagination-box').hide()
                var labelVerify = $('#dataType').val()
                var paramStr = ''
                if (labelVerify == 0) {
                    paramStr = 'type=1&pageNo='+pageNo+'&pageSize='+pageSize+'&token=' + $.cookie('AuthorizationAdmin')
                } else {
                    paramStr = 'type=1&labelVerify='+labelVerify+'&pageNo='+pageNo+'&pageSize='+pageSize+'&token=' + $.cookie('AuthorizationAdmin')
                }
                $.ajax({
                    url: service_url + '/a/zhiku/zkLinkInteraction/list?'+paramStr,
                    type: 'GET',
                    xhrFields: {
                        withCredentials: true
                    },
                    crossDomain: true,
                    contentType: 'application/json',
                    dataType: 'jsonp',
                    jsonpCallback:"success_jsonpCallback",  
                    processData: false, // 告诉jQuery不要去处理发送的数据
                    success: function(data) {
                        
                        var data = JSON.parse(data.data)
                        var list = data.list
                        // console.log(data, data.length)
                        if (data.count === 0) {
                            $('#list').append('<tr><td colspan="6">暂无数据</td></tr>')
                        } else {
                            var tempHtml = ''
                            for (var i = 0; i < list.length; i++) {
                                var labelVerifyHtml = ''
                                var doHtml = ''
                                var labelVerify = list[i].labelVerify
                                var description = list[i].description
                                if (description.length > 28) description = description.slice(0,25) + '...'
                                // var createDateStr = list[i].createDateStr.split(' ')[0]
                                if (labelVerify === '-1') {
                                    labelVerifyHtml = '<span class="examine-no">未审核</span>'
                                    doHtml = '<span class="do-chakan" add-id="'+list[i].id+'">查看</span><span class="do-xiugai" add-id="'+list[i].id+'">修改</span><span class="do-shenhe" add-id="'+list[i].id+'">审核</span><span class="do-shanchu" add-id="'+list[i].id+'">删除</span>'
                                } else if (labelVerify === '1') {
                                    labelVerifyHtml = '<span class="examine-yes">已审核</span>'
                                    doHtml = '<span class="do-chakan" add-id="'+list[i].id+'">查看</span>'
                                    
                                }

                                tempHtml = tempHtml + '<tr><td>'+((pageNo-1)*pageSize+i+1)+'</td><td>'+list[i].entName+'</td><td>'+description+'</td><td>'+labelVerifyHtml+'</td><td>'+doHtml+'</td></tr>'
                            }
                            $('#list').append(tempHtml)
                            $('.pagination-box').show()
                            $('.pagination').jqPaginator({
                                totalCounts: data.count,
                                pageSize: pageSize,
                                visiblePages: 10,
                                currentPage: pageNo,
                                first: '<li class="first"><a href="javascript:void(0);">首页<\/a><\/li>',
                                prev: '<li class="prev"><a href="javascript:void(0);">&laquo;<\/a><\/li>',
                                next: '<li class="next"><a href="javascript:void(0);">&raquo;<\/a><\/li>',
                                last: '<li class="last"><a href="javascript:void(0);">末页<\/a><\/li>',
                                page: '<li class="page"><a href="javascript:void(0);">{{page}}<\/a><\/li>',
                                onPageChange: function (num, type) {
                                    if (type === 'change') {
                                        pageNo = num
                                        loadResult()
                                    }
                                }
                            });
                        }
                    },
                    error: function(XMLHttpRequest, textStatus, errorThrown) {
                        console.log(XMLHttpRequest, textStatus, errorThrown)
                    }
                })
            }

        </script>
	</body>

</html>